<?php
require_once 'Model.php';
class MyFunction {
	var $md;
	public function __construct() {
		$this->md = new Model ();
	}
	public function setDataContent($iddm, $tenbao, $tieude, $tomtat, $noidung, $thoigian) {
		$query = "INSERT INTO noidung 
				VALUES(0,'$iddm','$tenbao','$tieude','$tomtat','$noidung','$thoigian')";
		// var_dump($this->md->Query ( $query ));exit();
		return $this->md->Query ( $query );
	}
	// dantri
	public function getDantriTT() {
		$query = "SELECT * FROM noidung WHERE tenbao='dantri' AND iddanhmuc=1";
		return $this->md->Query ( $query );
	}
	public function getDantriTS() {
		$query = "SELECT * FROM noidung WHERE tenbao='dantri' AND iddanhmuc=2";
		return $this->md->Query ( $query );
	}
	public function getDantriTG() {
		$query = "SELECT * FROM noidung WHERE tenbao='dantri' AND iddanhmuc=3";
		return $this->md->Query ( $query );
	}
	public function getDantriTTH() {
		$query = "SELECT * FROM noidung WHERE tenbao='dantri' AND iddanhmuc=4";
		return $this->md->Query ( $query );
	}
	public function getDantriPL() {
		$query = "SELECT * FROM noidung WHERE tenbao='dantri' AND iddanhmuc=5";
		return $this->md->Query ( $query );
	}
	public function getDantriGT() {
		$query = "SELECT * FROM noidung WHERE tenbao='dantri' AND iddanhmuc=6";
		return $this->md->Query ( $query );
	}
	public function getDantriSK() {
		$query = "SELECT * FROM noidung WHERE tenbao='dantri' AND iddanhmuc=7";
		return $this->md->Query ( $query );
	}
	// vnexpress
	public function getVnexpressTT() {
		$query = "SELECT * FROM noidung WHERE tenbao='vnexpress' AND iddanhmuc=1";
		return $this->md->Query ( $query );
	}
	public function getVnexpressTS() {
		$query = "SELECT * FROM noidung WHERE tenbao='vnexpress' AND iddanhmuc=2";
		return $this->md->Query ( $query );
	}
	public function getVnexpressTG() {
		$query = "SELECT * FROM noidung WHERE tenbao='vnexpress' AND iddanhmuc=3";
		return $this->md->Query ( $query );
	}
	public function getVnexpressTTH() {
		$query = "SELECT * FROM noidung WHERE tenbao='vnexpress' AND iddanhmuc=4";
		return $this->md->Query ( $query );
	}
	public function getVnexpressPL() {
		$query = "SELECT * FROM noidung WHERE tenbao='vnexpress' AND iddanhmuc=5";
		return $this->md->Query ( $query );
	}
	public function getVnexpressGT() {
		$query = "SELECT * FROM noidung WHERE tenbao='vnexpress' AND iddanhmuc=6";
		return $this->md->Query ( $query );
	}
	public function getVnexpressSK() {
		$query = "SELECT * FROM noidung WHERE tenbao='vnexpress' AND iddanhmuc=7";
		return $this->md->Query ( $query );
	}
	// bao24
	public function getBao24TT() {
		$query = "SELECT * FROM noidung WHERE tenbao='bao24' AND iddanhmuc=1";
		return $this->md->Query ( $query );
	}
	public function getBao24TS() {
		$query = "SELECT * FROM noidung WHERE tenbao='bao24' AND iddanhmuc=2";
		return $this->md->Query ( $query );
	}
	public function getBao24TG() {
		$query = "SELECT * FROM noidung WHERE tenbao='bao24' AND iddanhmuc=3";
		return $this->md->Query ( $query );
	}
	public function getBao24TTH() {
		$query = "SELECT * FROM noidung WHERE tenbao='bao24' AND iddanhmuc=4";
		return $this->md->Query ( $query );
	}
	public function getBao24PL() {
		$query = "SELECT * FROM noidung WHERE tenbao='bao24' AND iddanhmuc=5";
		return $this->md->Query ( $query );
	}
	public function getBao24GT() {
		$query = "SELECT * FROM noidung WHERE tenbao='bao24' AND iddanhmuc=6";
		return $this->md->Query ( $query );
	}
	public function getBao24SK() {
		$query = "SELECT * FROM noidung WHERE tenbao='bao24' AND iddanhmuc=7";
		return $this->md->Query ( $query );
	}
	//all
	public function deleteAll($news){
		$query = "DELETE FROM noidung WHERE tenbao='$news'";
		return $this->md->Query ( $query );
	}
}